package com.rem.mp.mapper;


import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.rem.mp.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author Rem
 * @Date 2020-02-25
 */
@Mapper
@Repository
public interface UserMapper extends BaseMapper<User> {


    //在mapper.xml中写SQL
    User getById(Long id);

    //自定义sql
    @Select("select * from tb_user ${ew.customSqlSegment}")
    List<User> selectAll(@Param(Constants.WRAPPER) Wrapper<User> wrapper);

    //自定义分页  在mapper.xml中写SQL
    IPage<User> selectPageUser(Page<User> page, @Param(Constants.WRAPPER) Wrapper<User> wrapper);

}
